﻿//----------------------------------------------------------------------------------------------------
// The The Main Menu State of the game
//----------------------------------------------------------------------------------------------------

package HG.GameStates
{
	import flash.events.*;
	
	import HG.Debug;
	import HG.GameService;
	import HG.Managers.StateManager;
	
	public class MenuState extends IGameState
	{
		var m_stateManager:StateManager;
		
		//----------------------------------------------------------------------------------------------------
		public function MenuState()
		{
			m_stateName = "MenuState";
		}
		
		//----------------------------------------------------------------------------------------------------
		public override function Begin()
		{
			super.Begin();
			
			m_stateManager = GameService.GetInstance().GetStateManager();
			
			Debug.ASSERT(m_movie, "No Menu Clip");
			Debug.ASSERT(m_movie.Content, "No Menu Content");
			
			m_movie.Content.Button_Play.addEventListener(MouseEvent.CLICK, Button_Play);
			m_movie.Content.Button_Editor.addEventListener(MouseEvent.CLICK, Button_Editor);
		}
		
		//----------------------------------------------------------------------------------------------------
		public override function End()
		{
			super.End();
		}
		
		//----------------------------------------------------------------------------------------------------
		public override function OnTick(DetaTime:Number)
		{
			
		}
		
		//----------------------------------------------------------------------------------------------------
		// Button Callbacks
		//----------------------------------------------------------------------------------------------------
		private function Button_Play(me:MouseEvent):void
		{
			m_stateManager.SwitchtoState(StateManager.STATE_PLAY);
		}
		
		//----------------------------------------------------------------------------------------------------
		private function Button_Editor(me:MouseEvent):void
		{
			m_stateManager.SwitchtoState(StateManager.STATE_EDITOR);
		}
		
		//----------------------------------------------------------------------------------------------------

	}

}